package com.opennews.openplatform

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.springframework.http.HttpStatus

@Slf4j
@CompileStatic
abstract class BaseController {
    protected def sendDataResponse(result) {
        respond([
            success: true,
            result: result
        ], formats: ["json", "xml"])

        // render([
        //     success: true,
        //     result: result
        // ] as JSON)
    }

    protected def sendStatusResponse(HttpStatus httpStatus) {
        response.status = httpStatus.value()
    }
}